<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>湖北康正物业服务有限公司</title>
<link href="images/css.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
	function checkForm() {
		var deptId = document.forms[0].deptId.value;
		var distId = document.forms[0].distId.value;

		if (deptId==0&&distId==0) {
			alert("请选择所属部门或物业服务处！");
			return false;
		}
		return true;
	}
</script>
</head>
<body>
<html:form action="user.do?method=update" method="post" onsubmit="return checkForm();">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="tableline" id="Table3">
    <html:hidden property="id" value="${user.id}" />
    <tr >
      <td colspan="2"></td>
    </tr>
    <tr class="m_lef">
      <td height="40" colspan="2" align="center" bgcolor="#ffffff" class="STYLE4">用户管理</td>
    </tr>
    <tr class="m_lef">
      <td width="144" height="26" align="right" bgcolor="#ffffff">用户：</td>
      <td width="712" bgcolor="#ffffff">&nbsp;<html:text property="username" value="${user.username }"/><font color="red">${error }</font></td>
    </tr>
    <tr class="m_lef">
      <td height="26" align="right" bgcolor="#ffffff">密码：</td>
      <td bgcolor="#ffffff">&nbsp;<html:password property="password" />
        </td>
    </tr>
    <tr class="m_lef">
      <td height="26" align="right" bgcolor="#ffffff" class="c_title_memed"><font face="宋体">重复密码：</font></td>
      <td bgcolor="#ffffff">&nbsp;<html:password property="password2" />
        </td>
    </tr>
    <tr class="m_lef">
      <td height="26" align="right" bgcolor="#ffffff" class="c_title_memed"><font face="宋体">用户姓名：</font></td>
      <td bgcolor="#ffffff">&nbsp;<html:text property="nickname" value="${user.nickname }"/></td>
    </tr>
    <tr class="m_lef">
      <td height="26" align="right" bgcolor="#ffffff" class="c_title_memed"><font face="宋体">用户身份：</font></td>
      <td bgcolor="#ffffff">
      <c:if test="${!empty roles}">
	  <c:forEach items="${roles }" var="role">
	  <html:multibox property="roleIds" value="${role.id }"></html:multibox>${role.description}
	  </c:forEach>
	  </c:if>
	  </td>
    </tr>
<tr class="m_lef">
      <td height="26" align="right" bgcolor="#ffffff" class="c_title_memed"><font face="宋体">所属部门：</font></td>
      <td bgcolor="#ffffff">
      &nbsp;<html:select property="deptId" style="width:155px">
				<html:option value="0">请选择</html:option>
				<c:if test="${!empty deptList}">
					<c:forEach items="${deptList}" var="dept">
						<html:option value="${dept.id}">${dept.deptName}</html:option>
					</c:forEach>
				</c:if>
			</html:select>
	  </td>
    </tr> 
    <tr class="m_lef">
      <td height="26" align="right" bgcolor="#ffffff" class="c_title_memed"><font face="宋体">所属物业服务处：</font></td>
      <td bgcolor="#ffffff">
            &nbsp;<html:select property="distId" style="width:155px">
				<html:option value="0">请选择</html:option>
				<c:if test="${!empty distList}">
					<c:forEach items="${distList}" var="dist">
						<html:option value="${dist.id}">${dist.name}</html:option>
					</c:forEach>
				</c:if>
			</html:select>
	  </td>
    </tr>      
    <tr>
      <td height="30" colspan="8" align="center" bgcolor="#ffffff" class="c_foot">
        <html:submit value="修改"/> <html:reset value="重置" /> </td>
    </tr>
  </table>
  </html:form>
</body>
</html>